package com.finalist.entity;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 组合商品
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "xx_combined_commodity")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_combined_commodity_sequence")
public class CombinedCommodity extends BaseEntity {

	/** 类型 */
	private Type type;

	/*
	 * public Set<Commodity> getComloditys() { return comloditys; }
	 * 
	 * public void setComloditys(Set<Commodity> comloditys) { this.comloditys =
	 * comloditys; }
	 */

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	/**
	 * 类型
	 */
	public enum Type {

		/** 妙关爱 */
		miao_care,

		/** 妙运动 */
		miao_sports,

		/** 妙瘦身 */
		miao_slimming
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "xx_combined_commodity_products")
	@JsonIgnore(value = true)
	public Set<Product> getProducts1() {
		return products1;
	}

	public void setProducts1(Set<Product> products1) {
		this.products1 = products1;
	}

	/*
	 * @OneToMany( fetch = FetchType.EAGER)
	 * 
	 * @Column(unique = false)
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "XX_COMBINED_COMMODITY_PROD_102")
	@JsonIgnore(value = true)
	public Set<Product> getProducts2() {
		return products2;
	}

	public void setProducts2(Set<Product> products2) {
		this.products2 = products2;
	}

	/*
	 * @OneToMany( fetch = FetchType.EAGER, cascade = CascadeType.ALL,
	 * orphanRemoval = true)
	 */
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "XX_COMBINED_COMMODITY_PROD_103")
	@JsonIgnore(value = true)
	public Set<Product> getProducts3() {
		return products3;
	}

	public void setProducts3(Set<Product> products3) {
		this.products3 = products3;
	}

	/**
	 * 合约类型
	 */
	public enum ContractType {

		/** 12个月 */
		oneyear,

		/** 24个月 */
		twoyear
	};

	/** 合约类型,如：12个月、24个月 */
	private ContractType contractType;
	/** 价钱 */
	private BigDecimal price;

	/** 风客旅行预约款 */
	private BigDecimal subscribePrice;

	/** 微信预约款 */
	private BigDecimal weiSubscribePrice;

	/** APP预约款 */
	private BigDecimal appSubscribePrice;

	/** 风客旅行补贴价 */
	private BigDecimal subsidiesPrice;

	/** 微信商城补贴价 */
	private BigDecimal weiSubsidiesPrice;

	/** APP补贴价 */
	private BigDecimal appSubsidiesPrice;

	private Boolean isMiao = true;
	private Boolean isWei;
	private Boolean isApp;

	public Boolean getIsMiao() {
		return isMiao;
	}

	public void setIsMiao(Boolean isMiao) {
		this.isMiao = isMiao;
	}

	public Boolean getIsWei() {
		return isWei;
	}

	public void setIsWei(Boolean isWei) {
		this.isWei = isWei;
	}

	public Boolean getIsApp() {
		return isApp;
	}

	public void setIsApp(Boolean isApp) {
		this.isApp = isApp;
	}

	public BigDecimal getWeiSubscribePrice() {
		return weiSubscribePrice;
	}

	public void setWeiSubscribePrice(BigDecimal weiSubscribePrice) {
		this.weiSubscribePrice = weiSubscribePrice;
	}

	public BigDecimal getAppSubscribePrice() {
		return appSubscribePrice;
	}

	public void setAppSubscribePrice(BigDecimal appSubscribePrice) {
		this.appSubscribePrice = appSubscribePrice;
	}

	public BigDecimal getWeiSubsidiesPrice() {
		return weiSubsidiesPrice;
	}

	public void setWeiSubsidiesPrice(BigDecimal weiSubsidiesPrice) {
		this.weiSubsidiesPrice = weiSubsidiesPrice;
	}

	public BigDecimal getAppSubsidiesPrice() {
		return appSubsidiesPrice;
	}

	public void setAppSubsidiesPrice(BigDecimal appSubsidiesPrice) {
		this.appSubsidiesPrice = appSubsidiesPrice;
	}

	public ContractType getContractType() {
		return contractType;
	}

	public void setContractType(ContractType contractType) {
		this.contractType = contractType;
	}

	public BigDecimal getSubscribePrice() {
		return subscribePrice;
	}

	public void setSubscribePrice(BigDecimal subscribePrice) {
		this.subscribePrice = subscribePrice;
	}

	public BigDecimal getSubsidiesPrice() {
		return subsidiesPrice;
	}

	public void setSubsidiesPrice(BigDecimal subsidiesPrice) {
		this.subsidiesPrice = subsidiesPrice;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	private Set<Product> products1 = new HashSet<Product>();

	private Set<Product> products2 = new HashSet<Product>();

	private Set<Product> products3 = new HashSet<Product>();

	/* private Set<Commodity> comloditys = new HashSet<Commodity>(); */

}
